<?php
/*
Copy this file into your current active theme's directory to customize this template

This template lists out your older albums
*/

$numAlbumPreviews = 3; // how many expanded album previews to show. all other albums will be reduced to a thumbnail
$maxAlbums = 50; // max number of album thumbnails to show on the photo album's homepage

if (count($albums)): ?>
<div class="tt-older-posts albums">
<h4><?php _e('Other Albums', 'tantan-flickr');?></h4>
<?php for ($i=0;$i<$numAlbumPreviews;$i++):?>
<?php  
	if (!$albums) break;
    $album = array_shift($albums); 
    $primaryPhoto = $flickr->getPhotoSizes($album['primary']); 
?>
    <div class="album">
    <a href="album/<?php echo $album['id']?>/<?php echo $album['pagename']?>"><img class="highlight" src="<?php echo $primaryPhoto['Square']['source']?>" width="<?php echo $primaryPhoto['Square']['width']?>" height="<?php echo $primaryPhoto['Square']['height']?>" alt="" /></a>
    <h2><a href="album/<?php echo $album['id']?>/<?php echo $album['pagename']?>"><?php echo $album['title']?></a></h2>
    <p><?php echo html_entity_decode($album['description'])?></p>
    <p class="meta"><?php printf(__('%d Photos', 'tantan-flickr'), $album['photos']);?> | <a href="album/<?php echo $album['id']?>/<?php echo $album['pagename']?>" onclick="return openSlideShow('<?php echo $album['id']?>')"><?php _e('View slideshow &gt;', 'tantan-flickr');?></a>
    </p>
    </div>

<?php endfor; ?>
</div>
<?php endif; /*albums*/ ?>

<?php if (count($albums)): ?>
<div class="tt-older-posts albums albums-small">
<?php
$i = 0;
foreach ($albums as $album):?>
    <?php  $primaryPhoto = $flickr->getPhotoSizes($album['primary']); ?>
    <div class="album">
    <a href="album/<?php echo $album['id']?>/<?php echo $album['pagename']?>"><img class="highlight" 
        src="<?php echo $primaryPhoto['Square']['source']?>" width="<?php echo $primaryPhoto['Square']['width']?>" height="<?php echo $primaryPhoto['Square']['height']?>" alt="" /></a><br />
    <strong><?php echo $album['title'];?></strong>
    </div>
<?php 
if ($i++ > $maxAlbums) break;
endforeach; ?>
</div>
<?php endif; /*albums*/ ?>

<?php if (count($albums) > $maxAlbums): ?>
	<a href="./?view=all" class="all-albums"><?php printf(__('View all %d albums &gt;', 'tantan-flickr'), $numAlbums);?></a>
<?php endif ;?>